import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import svgr from 'vite-plugin-svgr'

export default defineConfig({
  main: {
    plugins: [externalizeDepsPlugin()]
  },
  preload: {
    plugins: [externalizeDepsPlugin()]
  },
  renderer: {
    resolve: {
      alias: {
        '@': resolve('src/renderer/src'),
        '@assets': resolve('src/renderer/src/assets'),
        '@images': resolve('src/renderer/src/assets/images'),
        '@styles': resolve('src/renderer/src/assets/styles'),
        '@components': resolve('src/renderer/src/components'),
        '@utils': resolve('src/renderer/src/utils'),
        '@views': resolve('src/renderer/src/views'),
        '@store': resolve('src/renderer/src/store'),
        '@mixins': resolve('src/renderer/src/mixins'),
        '@services': resolve('src/renderer/src/services'),
        '@directive': resolve('src/renderer/src/directive'),
        '@context': resolve('src/renderer/src/context'),
        '@constants': resolve('src/renderer/src/constants'),
        '@commonComponents': resolve('src/renderer/src/common/components'),
        '@commonUtils': resolve('src/renderer/src/common/utils')
      }
    },
    plugins: [react(), svgr()]
  }
})
